import { Router } from 'express';

import Valid from '../../middleware/validation';
import { create, detail, list, remove, update } from './api';

const router = Router();

// 创建仓库 POST:/api/repo
// router.post('/', Valid.body(create.validator), create.api);

// 删除仓库 DELETE:/api/repo/:ID
router.delete('/:ID', Valid.params(remove.validator), remove.api);

// 获取仓库列表 GET:/api/repo
router.get('/', Valid.query(list.validator), list.api);

// 更新仓库信息 PUT:/api/repo/:ID
// router.put(
//   '/:ID',
//   [Valid.params(update.validator.params), Valid.body(update.validator.body)],
//   update.api,
// );

// 获取仓库详情 GET:/api/repo/:ID
router.get('/:ID', Valid.params(detail.validator), detail.api);

export default router;
